Communication apparatus, method and system

ABSTRACT

If a network having the same SSID as but a different BSSID from those of a network that has been established by a first communication apparatus is detected, the network established by the first communication apparatus is terminated and the first communication apparatus participates in the detected network. This makes it possible for the first communication apparatus and another communication apparatus to participate in the same network.

This application is a continuation of U.S. Application No. 12/097,475which is a National Stage of PCT/JP2007/051846 filed Jan. 30, 2007, thecontents of each of which are incorporated herein by reference.

TECHNICAL FIELD

The present invention relates to a communication apparatus,communication method and communication system.

BACKGROUND ART

A large number of devices equipped with a wireless function including anIEEE (Institute of Electrical and Electronics Engineers) 802.11 wirelessLAN have been registered and manufactured in recent years.

An example of a communication method based upon the IEEE 802.11 wirelessLAN is the ad-hoc mode, in which terminals communicate with each otherdirectly. This is in addition to the infrastructure mode, in whichcommunication is performed via access points.

In the ad-hoc mode of an IEEE 802.11 wireless LAN, a terminal attemptingto establish a network transmits a notification signal, which isreferred to as a beacon, thereby establishing the network. A terminalthat is to participate in the network does so and communicates basedupon information (beacon period, transmission rate, etc.) contained inthe beacon.

Between terminals that construct the network, the communication channeland wireless communication parameters such as the network identifier,encryption methods and encryption key must be set to common values. Inan IEEE 802.11 wireless LAN, there are two types of network identifiers,namely SSID (Service Set Identification) and BSSID (Basic Service SetIdentification) [see the specification of U.S. Patent Laid-Open No.2005/250487 (Japanese Patent Application Laid-Open No. 2005-323116)].

The SSID is an identifier that can be set to any value by the user andthat is also capable of being set in a terminal in advance. On the otherhand, the BSSID is an identifier generated by a terminal thatestablishes an ad-hoc network, namely a terminal that transmits a beaconfirst, based upon the terminal's own MAC (Media Access Control) address,etc. In a case where terminals communicate via the same wirelesscommunication, these two network identifiers must be set to a commonvalue between the terminals.

For example, in order to perform wireless communication in the ad-hocmode, assume that a common SSID is set between two terminals in advance.In order for one of these terminals to establish an ad-hoc network, theterminal generates the BSSID and starts to transmit a beacon. When thisis done, the other terminal sets itself to this BSSID, thereby making itpossible to communicate in the ad-hoc mode.

However, there is the possibility that when both terminals attempt toestablish an ad-hoc network substantially simultaneously, each terminalwill generate a respective BSSID and start transmitting a beacon,thereby constructing separate ad-hoc networks. In such case the twoterminals will not be able to communicate wirelessly with each otherregardless of the fact that the same SSID has been set.

DISCLOSURE OF INVENTION

The present invention so arranges it that even if a plurality ofcommunication apparatuses that intend to participate in the same networkhave constructed different networks, the same network can beconstructed.

According to one aspect of the present invention, there is provided acommunication apparatus for communicating with another communicationapparatus using a first network identifier and a second networkidentifier, comprising: a detection unit adapted to detect a networkthat is present in the surroundings; a discrimination unit adapted todiscriminate a first network identifier and a second network identifierof a network detected by the detection unit; a comparison unit adaptedto compare the first and second network identifiers discriminated by thediscrimination unit and the first and second network identifiers,respectively, of the network to which the communication apparatusbelongs; and a control unit adapted to control participation in thedetected network in accordance with result of the comparison performedby the comparison unit.

According to another aspect of the present invention, there is provideda communication apparatus for communication with another communicationapparatus using a network identifier, comprising: a detection unitadapted to detect a network that is present in the surroundings; acomparison unit adapted to compare a network identifier of a networkdetected by the detection unit and a network identifier of a network towhich the communication apparatus belongs; and a control unit adapted toterminate communication by the network to which the communicationapparatus belongs and allow the communication apparatus to participatein the detected network in accordance with result of the comparisonperformed by the comparison unit.

Furthermore, according to another aspect of the present invention, thereis provided a communication system for performing communication using afirst network identifier that has been set in a first communicationapparatus and in a second communication apparatus, the firstcommunication apparatus comprising: a detection unit adapted to detect anetwork to which the second communication apparatus belongs; acomparison unit adapted to compare a second network identifier of thenetwork detected by the detection unit and a second network identifierof the network to which the first communication apparatus belongs; and acontrol unit adapted to allow the first communication apparatus and thesecond communication apparatus to participate in the same network basedupon result of the comparison performed by the comparison unit.

Furthermore, according to another aspect of the present invention, thereis provided a method whereby a plurality of communication apparatusesconstruct a network, comprising: a first step of constructing a networkby allowing a second communication apparatus to participate in a networkestablished by a first communication apparatus; a second step ofconstructing a network by allowing the first communication apparatus toparticipate in a network established by the second communicationapparatus; and a third step of selectively executing construction of anetwork by either the first or second step in dependence upon the typeof communication apparatus that constructs the network.

Furthermore, according to another aspect of the present invention, thereis provided a communication method of communicating with anothercommunication apparatus using a first network identifier and a secondnetwork identifier, comprising: a detection step of detecting a networkthat is present in the surroundings; a discrimination step ofdiscriminating a first network identifier and a second networkidentifier of a network detected at the detection step; a comparisonstep of comparing the first and second network identifiers discriminatedat the discrimination step and the first and second network identifiers,respectively, of the network to which the communication apparatusbelongs; and a control step of controlling participation in the detectednetwork in accordance with result of the comparison performed by thecomparison unit.

Further features of the present invention will become apparent from thefollowing description of exemplary embodiments with reference to theattached drawings.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a diagram illustrating the configuration of a wirelesscommunication network in first to fourth embodiments of the presentinvention;

FIG. 2 is a functional block diagram of a digital still camera (DSC) inthe first to fourth embodiments;

FIG. 3 is a functional block diagram of a printer in the first to fourthembodiments;

FIG. 4 is a sequence diagram illustrating a procedure for constructingan ad-hoc network according to the first embodiment;

FIG. 5 is a flowchart illustrating operation of the DSC and printeraccording to the first embodiment;

FIG. 6 is a flowchart illustrating operation of the DSC and printeraccording to the second embodiment;

FIG. 7 is a flowchart illustrating operation of the DSC and printeraccording to the second embodiment;

FIGS. 8A to 8D illustrate examples of display units of the DSC andprinter according to the third embodiment;

FIGS. 9A to 9C illustrate examples of some information relating to theDSC and printer according to the third embodiment;

FIG. 10 is a sequence diagram illustrating a case where communicationpartner information is registered in the third embodiment;

FIG. 11 is a flowchart illustrating operation of the printer accordingto the fourth embodiment; and

FIG. 12 is a flowchart illustrating operation of the DSC according tothe fourth embodiment.

BEST MODE FOR CARRYING OUT THE INVENTION

Preferred embodiments of the present invention will be described indetail with reference to the drawings. It should be noted that thepresent invention is not limited to the embodiment and can be modifiedin various ways within the scope of the claims.

(First Embodiment)

FIG. 1 is a diagram illustrating an example of the configuration of awireless communication network in a first embodiment of the presentinvention. Described in this embodiment is a case where an ad-hocnetwork is constructed between a digital still camera (DSC) 101 and aprinter 102 each of which serves as a wireless communication apparatus.

In order to construct the ad-hoc network, two network identifiers,namely the SSID (Service Set Identification) and BSSID (Basic ServiceSet Identification), must be set to a common value.

The SSID is an identifier that can be set to any value by the user andthat is also capable of being set in a terminal in advance. In thisembodiment, “AdhocNet” has been set beforehand as the SSID in the DSC101 and printer 102.

On the other hand, the BSSID is an identifier generated by a terminalthat establishes an ad-hoc network, namely a terminal that transmits abeacon first, based upon the terminal's own MAC (Media Access Control)address, etc.

By pressing wireless communication buttons provided on respective onesof the DSC 101 and printer 102, these start executing processing forconstructing the ad-hoc network. For example, when the wirelesscommunication button on the DSC 101 is pressed, the DSC 101 checks todetermine whether a network whose SSID is “AdhocNet” exists, namelywhether the printer 102 has already established a network. If theprinter 102 has already established a network, then the DSC 101 is setto the BSSID generated by the printer 102 and participates in thenetwork. If the printer 102 has not established a network, on the otherhand, then the DSC 101 itself establishes a network, generates the BSSIDand starts transmission of a beacon.

FIG. 2 is a functional block diagram of a DSC 101 according to the firstembodiment.

A control panel 210 is connected to a CPU 215 via a system controller211. The control panel 210 includes various keys such as ashutter-release switch and wireless communication button. The systemcontroller 211 has a timer (not shown).

An image sensing unit 202 is a block for sensing an image when theshutter-release switch of the control panel 210 is pressed. An imagesignal that is output from the image sensing unit 202 is processed by animaging processing unit 203.

A display unit 206 is a block for presenting information to the user andis an LCD (Liquid Crystal Display), LED (Light-Emitting Diode) displayor voice display, etc. Processing for controlling the content of thedisplay presented by the display unit 206 is executed by a displayprocessor 207. Further, operation such as the selection of desiredinformation from information displayed by the display unit 206 iscarried out in operative association with the control panel 210. Thatis, the display unit 206 and control panel 210 construct a userinterface.

A memory-card interface 208 is an interface for connecting a memory card209. A USB (Universal Serial Bus) interface 212 is an interface forconnecting an external device using a USB. An audio interface 214 is aninterface for connecting an audio signal to an external device.

A wireless communication RF unit 205 and a wireless communicationcontroller 204 are combined to construct a wireless unit. The wirelesscommunication RF unit 205 includes a hardware block for digitizing ananalog signal received from an antenna and, conversely, for convertingdigital information to an analog signal and transmitting the signal fromthe antenna. The wireless communication controller 204 is constituted bya MAC layer that controls communication and hardware for processingfirmware that drives the MAC layer. The wireless communicationcontroller 204 has an internal flash ROM that is capable of storing aMAC address, etc.

The functional portions indicated in this block diagram are implementedby control exercised by the CPU 215. A program for implementing theprocessing of FIGS. 5, 6, 7 and 12 described later has been stored in aROM (Read-Only Memory) 216 or flash ROM 213 and the CPU 215 executesprocessing in accordance with this program. The firmware for thewireless unit has been stored in a flash ROM, etc., within the wirelesscommunication controller 204, in the flash ROM 213 provided on the sideof the DSC 101, or in the ROM 216. In the case of the latter, thefirmware is loaded in the wireless communication controller 204 when thewireless unit is utilized. Further, parameters such as the SSID and anencryption key that are necessary for wireless communication have beenstored in the flash ROM 213. When the wireless unit is utilized, adriver delivers these values to the wireless communication controller204, thereby making wireless communication possible.

Further, data to be processed by the CPU 215 is written to and read froma RAM (Random-Access Memory) 217 or the flash ROM 213. The flash ROM 213is a non-volatile storage area. Image data resulting from imaging isstored on the memory card 209 via the memory-card interface 208.

FIG. 3 is a functional block of the printer 102 according to the firstembodiment. A printer control panel 310 is connected to a CPU 315 via asystem controller 311. The printer control panel 310 includes variouskeys such as a wireless communication button. The system controller 311has a timer (not shown).

A print engine 302, which is a functional block for actually printing animage on paper, is controlled by a print processor 303. Any type ofprint engine 302 may be used so long as it has a function for printingan image on paper. However, the printer 102 shown in FIG. 1 is anink-jet printer for discharging ink droplets onto a print medium such aspaper by thermal energy.

A display unit 306 is a block for presenting information to the user andis an LCD, LED display or voice display, etc. Control of the content ofthe display presented by the display unit 306 is performed by a displayprocessor 307. Further, operation such as the selection of desiredinformation from information displayed by the display unit 306 iscarried out via the control panel 310. That is, the display unit 306 andcontrol panel 310 construct the user interface of the printer 102.

A memory-card interface 308 is an interface for connecting a removablememory card 309. By inserting the memory card, with which the DSC isequipped, into the interface, an image captured by imaging can beprinted.

A USB interface 312 is an interface for connecting an external deviceusing a USB. An ETHER interface 314 is an interface for connecting anexternal device using ETHER communication.

A wireless communication RF unit 305 and a wireless communicationcontroller 304 are combined to construct a wireless unit. The wirelesscommunication RF unit 305 includes a hardware block for digitizing ananalog signal received from an antenna and, conversely, for convertingdigital information to an analog signal and transmitting the signal fromthe antenna. The wireless communication controller 304 is constituted bya MAC layer that controls communication and hardware for processingfirmware that drives the MAC layer. The wireless communicationcontroller 304 has an internal flash ROM that is capable of storing aMAC address, etc.

The functional portions indicated in this block diagram are implementedby control exercised by the CPU 315. A program for implementing theprocessing of FIGS. 5, 6, 7 and 11 described later has been stored in aROM 316 or in a flash ROM 313 and the CPU 315 executes processing inaccordance with this program. The firmware for the wireless unit hasbeen stored in a flash ROM, etc., within the wireless communicationcontroller 304, in the flash ROM 313 provided on the side of the printer102, or in the ROM 316. In the case of the latter, the firmware isloaded in the wireless communication controller 304 when the wirelessunit is utilized. Further, parameters such as the SSID and an encryptionkey that are necessary for wireless communication have been stored inthe flash ROM 313. When the wireless unit is utilized, a driver deliversthese values to the wireless communication controller 304, therebymaking wireless communication possible.

Further, data to be processed by the CPU 315 is written to and read froma RAM 317 or the flash ROM 313.

FIG. 4 is a diagram illustrating a sequence in a case where the DSC 101and printer 102 have established an ad-hoc network substantiallysimultaneously. Described here will be a case where this sequence isgenerated by pressing the wireless communication buttons of the DSC 101and printer 102 substantially simultaneously.

When the wireless communication button of the printer 102 is pressed,the application program sends the driver a request to construct anad-hoc network whose SSID is “AdhocNet” (S401).

Upon receiving the request from the application program, the driverstarts scanning (search processing) in order to determine whether anad-hoc network having the “AdhocNet” SSID exists. First, a series ofcommands for scanning are issued from the driver to the wirelesscommunication controller 304 (S402). Next, the commands are processed bythe wireless communication controller 304 and wireless communication RFunit 305 and a probe request (search request) is transmitted thereby(S403). Receipt of a response (probe response) to the probe request isawaited for a fixed period of time.

Since the probe response includes the SSID, whether a network having the“AdhocNet” SSID already exists can be checked by extracting the SSIDfrom the probe response received.

Further, if “AdhocNet” is specified in the SSID of the probe request andtransmitted, then only a communication apparatus that constructs thenetwork whose SSID is “AdhocNet” will send back a probe response.Accordingly, whether a network whose SSID is “AdhocNet” has already beenconstructed or not can be determined in dependence upon whether or notthe probe response is received.

At this point in time the DSC 101 has not yet established an ad-hocnetwork and therefore the response standby time elapses without theprinter 102 receiving a probe response.

Upon confirming that a network does not exist (S404), the driver of theprinter 102 sends the wireless communication controller 304 a series ofsetting commands for establishing an ad-hoc network whose SSID is“AdhocNet” (S405).

The wireless communication controller 304 processes the commandsreceived from the driver and establishes an ad-hoc network having“AdhocNet” as its SSID. More specifically, the wireless communicationcontroller 304 generates a BSSID from the MAC address of its own printer102 and starts transmitting a beacon.

The processing executed by the DSC 101 will be described next.

When the wireless communication button on the DSC 101 is pressed, anapplication program sends the driver a request to construct the ad-hocnetwork whose SSID is “AdhocNet” (S406).

Upon receiving the request from the application program, the driverstarts scanning in order to determine whether an ad-hoc network havingthe “AdhocNet” SSID exists. First, a series of commands for scanning areissued from the driver to the wireless communication controller 204(S407).

Next, the commands are processed by the wireless communicationcontroller 204 and wireless communication RF unit 205 and a proberequest is transmitted thereby (S408). Receipt of a probe response isawaited for a fixed period of time.

At this point in time the printer 102 has not yet established an ad-hocnetwork and therefore the response standby time elapses without the DSC101 receiving a probe response.

Upon confirming that a network does not exist (S409), the driver of theDSC 101 sends the wireless communication controller 204 a series ofsetting commands for establishing an ad-hoc network whose SSID is“AdhocNet” (S410). The wireless communication controller 204 processesthe commands received from the driver and establishes an ad-hoc networkhaving “AdhocNet” as its SSID. More specifically, the wirelesscommunication controller 204 generates a BSSID from the MAC address ofits own DSC 101 and starts transmitting a beacon.

At the moment step S410 ends, the DSC 101 and printer 102 constructseparate ad-hoc networks having different BSSIDs regardless of the factthat the SSIDs are identical, namely “AdhocNet”.

After establishing the ad-hoc network (S405), the printer 102 sets anytime T1 in the timer possessed by the system controller 311 (S411).Similarly, after step S410, the DSC 101 sets any time T2 in the timerpossessed by the system controller 211 (S412). In FIG. 4, the time T2set by the DSC 101 is shorter than the time T1 set by the printer 102and therefore time T2 in the timer of DSC 101 elapses first.

When time T2 elapses, the DSC 101 performs scanning in order todetermine whether an ad-hoc network having an SSID identical with theSSID “AdhocNet” of the ad-hoc network established by the DSC 101 itselfexists. The driver of the DSC 101 sends the wireless communicationcontroller 204 a series of commands for scanning purposes (S413). Thewireless communication controller 204 and the wireless communication RFunit 205 process the commands and transmit a probe request (S414).

Since the printer 102 has specified “AdhocNet” in the SSID andestablished an ad-hoc network, at this time the printer 102 sends back aprobe response to the DSC 101 (S415).

When the DSC 101 receives the probe response, the wireless communicationcontroller 204 delivers to the driver the information obtained from theprobe response (S416). From the delivered information, the driver learnsof the existence of the other ad-hoc network having the same SSID and adifferent BSSID from those of the network established by the DSC 101.

When this occurs, the driver of the DSC 101, in order to participate inthe ad-hoc network established by the printer 102, sends the wirelesscommunication controller 204 a series of setting commands forterminating the network established by the DSC 101 (S417).

The driver of the DSC 101 then sends the wireless communicationcontroller 204 a series of setting commands in order to participate inthe ad-hoc network whose SSID is “AdhocNet”. Thus, the DSC 101 sets theBSSID to a value identical with that of the network established by theprinter 102 and participates in the network.

When the time T1 elapses, the printer 102 performs scanning in order todetermine whether an ad-hoc network having an SSID identical with theSSID “AdhocNet” being used by the printer 102 exists. The driver of theprinter 102 sends the wireless communication controller 304 a series ofcommands for scanning purposes (S419). The wireless communicationcontroller 304 and the wireless communication RF unit 305 process thecommands and transmit a probe request (S420).

Since the DSC 101 is already participating in the same ad-hoc network asthe printer 102 at this time, the DSC 101 sends a probe response back tothe printer 102 (S421).

When the printer 102 receives the probe response, the wirelesscommunication controller 304 delivers to the driver the informationobtained from the probe response (S422). The driver of the printer 102compares the delivered information with the information relating to thenetwork established by the printer 102 and can tell that the DSC 101 isparticipating in the same ad-hoc network as that of the printer 102.

FIG. 5 is a flowchart of operation of the DSC 101 and printer 102. Sincethe operating flows of the DSC 101 and printer 102 are the same, hereoperation will be described taking the operation of DSC 101 as anexample.

If construction of an ad-hoc network is specified by pressing thewireless communication of the DSC 101 (S501), the DSC 101 performsscanning to determine whether an ad-hoc network whose SSID is “AdhocNet”exists. More specifically, the DSC 101 transmits a probe request, inwhich “AdhocNet” is specified in the SSID, by broadcast (S502) and thenwaits a fixed period of time for a probe response to be sent back as aresponse (S503). Here the term “broadcast” refers to a transmission toan unspecified number of communication partners.

If the result of scanning is detection of an ad-hoc network whose SSIDis “AdhocNet” (“YES” at S504), then the DSC 101 executes processing forparticipating in the detected ad-hoc network (S513) and then terminatesprocessing.

If no network having the “AdhocNet” SSID exists (“NO” at S504), then theDSC 101 executes processing to establish an ad-hoc network whose SSID is“AdhocNet” (S505). More specifically, the DSC 101 generates a BSSIDbased upon its own MAC address and starts transmitting a beacon.

After establishing the ad-hoc network, the DSC 101 sets any value T inthe timer (S506) and then waits for the timer to time out (S507). If thetimer times out (“YES” at S507), then the DSC 101 performs scanning inorder to determine whether an ad-hoc network having an SSID identicalwith that of the network established by the DSC 101 exists (S508, S509).

If the result of scanning is that no network having the same SSID hasbeen detected (“NO” at S510), then processing from S506 onward isrepeated. If the result of scanning is detection of network having thesame SSID (“YES” at S510), then the DSC 101 determines whether the BSSIDof the detected network is identical with the BSSID of the networkestablished by the DSC 101 (S511). If the BSSID is identical (“YES” atstep S511), then the DSC 101 can tell that the other communicationapparatus (printer 102) is present on the same network. The DSC 101therefore terminates processing.

If the BSSID is not identical (“NO” at S511), then the DSC 101terminates the ad-hoc network that was established by the DSC 101 (S512)and executes processing for participating in the detected network(S513). That is, the DSC 101 sets the BSSID to a value identical withthat of the BSSID of the detected network.

It should be noted that after participating in the network (S513 in FIG.5), the DSC 101 may perform scanning again and execute processing fordetermining whether the other communication apparatus (printer 102) ispresent on the same network. Since the fact that the DSC 101 and printer102 have formed the same network can be verified by this processing,communication reliability can be further enhanced.

This embodiment is such that in a case where a network having the sameBSSID as that established by the apparatus itself is detected, theestablished network is terminated and the apparatus participates in thedetected network. Accordingly, a network can be constructed betweencommunication apparatuses that intend to participate in the samenetwork.

Thus, even in the event that two communication apparatuses haveestablished networks having different BSSIDs regardless of the fact thatthe respective SSIDs are identical, one communication apparatus canparticipate in the network that has been established by the othercommunication apparatus. This makes it possible to enhance communicationreliability and user convenience.

(Second Embodiment)

A second embodiment will be described next. It should be noted that thenetwork configuration and the hardware configurations of the DSC 101 andprinter 102 are similar to those of the first embodiment (see FIGS. 1, 2and 3) and need not be described again.

In this embodiment, the processing executed in a case where ad-hocnetworks having the same SSID but different BSSIDs is different fromthat of the first embodiment.

FIG. 6 is a flowchart of operation of the DSC 101 and printer 102according to this embodiment. Since the operating flows of the DSC 101and printer 102 are the same, here operation will be described takingthe operation of DSC 101 as an example. The processing of steps S601 toS610 is identical with that of the processing of steps S501 to S510 inFIG. 5 and need not be described again.

If the DSC 101 has detected a network whose SSID is identical with thatof network established by the DSC 101 (“YES” at S610), then, inaccordance with a prescribed rule, the DSC 101 compares the BSSID of thedetected network with that of the network established by the DSC 101itself (S611).

Examples of methods that can be mentioned as examples of rules used atthe time of the comparison are a method of adopting the smaller BSSIDvalue as inferior and the larger BSSID value as superior when the BSSIDsare handled as numerals, and a method of, conversely, adopting thesmaller value as superior and the larger value as inferior.

If the result of the comparison is that the BSSID of the networkestablished by the DSC 101 is judged to be inferior (“YES” at S611),then the DSC 101 terminates the network established by the DSC 101(S612) and executes processing for participating in the detected network(S613). That is, by setting its BSSID to be identical with the BSSID ofthe detected network, the DSC 101 is capable of constructing the samenetwork as that of the other communication apparatus (printer 102).

If the result of comparing the BSSIDs is that the BSSID of the networkestablished by the DSC 101 is judged to be superior or the same as theBSSID of the detected network (“NO” at S611), then the DSC 101terminates processing. In this case, the apparatus (printer 102) thatestablished the detected network participates in the network establishedby the DSC 101.

It should be noted that before BSSID superiority or inferiority isjudged at S611, the DSC 101 may check to see whether the BSSIDs areidentical, terminate processing when they are identical and make thesuperiority/inferiority judgment when they are not identical.

FIG. 7 is a diagram illustrating flow of operation with the addition ofprocessing for finally confirming whether the DSC 101 and printer 102were able to construct identical networks. The processing of steps S701to S710 in FIG. 7 is identical with steps S601 to S610 of FIG. 6 andneed not be described again.

If the DSC 101 has detected a network whose SSID is identical with thatof network established by the DSC 101 (“YES” at S710), then, inaccordance with a prescribed rule, the DSC 101 compares the BSSID of thedetected network with that of the network established by the DSC 101itself (S711).

If the result of the comparison is that the BSSID of the networkestablished by the DSC 101 is judged to be inferior (“YES” at S711),then the DSC 101 terminates the network established by the DSC 101(S712) and executes processing for participating in the detected network(S713). Then, in order to confirm whether another communicationapparatus (printer 102) exists on the network in which the DSC 101participates, control returns to S708 and the DSC 101 performs scanning.

If the result of comparing the BSSIDs is that the BSSID of the networkestablished by the DSC 101 is judged to be the same as the BSSID of thedetected network (“NO” at S711 and “YES” at S714), then the DSC 101 canrecognize that the other communication apparatus (printer 102) isparticipating in the same network. The DSC 101 therefore terminatesprocessing.

If the BSSID of the network established by the DSC 101 is judged to besuperior (“NO” at S711 and “NO” at S714), then control returns to S706and the DSC 101 executes processing for confirming that the othercommunication apparatus (printer 102) is participating in the networkestablished by the DSC 101. Since a certain length of time is necessaryin order for the other communication apparatus to participate in thenetwork, any value T is set in the timer before scanning is executed(S706). When the timer times out (“YES” at S707), the DSC 101 performsscanning (S708, S709).

This embodiment is such that in a case where two communicationapparatuses have established separate networks having identical SSIDsand different BSSIDs, which of the communication apparatuses willparticipate in the network established by the other communicationapparatus is decided in dependence upon the result of comparison of theBSSIDs. Accordingly, the communication apparatus that participates inthe network can be decided uniquely, the same network can be constructedefficiently and convenience can be enhanced.

Further, in accordance with FIG. 7, processing continues until it isconfirmed that the apparatuses are participating in the same network.This means that the DSC 101 and printer 102 are capable of constructingthe same network more reliably.

(Third Embodiment)

A third embodiment will be described next. It should be noted that thenetwork configuration and the hardware configurations of the DSC 101 andprinter 102 are similar to those of the first embodiment (see FIGS. 1, 2and 3) and need not be described again.

This embodiment will be described with regard to a processing method ina case where the DSC 101 and printer 102 are temporarily connectedwirelessly and information relating to the printer 102 is registered.

It will be assumed here that the SSID of a temporary ad-hoc networkconstructed in order to register information relating to thecommunication partner uses a value different from that of the SSID usedin ordinary wireless communication. Let “SetNet” be the SSID used inregistering the information relating to the communication partner, andassume that the DSC 101 and printer 102 have stored the SSIDs in theflash ROMs 213, 313, respectively, in advance.

FIGS. 8A to 8D are diagrams illustrating examples of the display units206 and 306 of the DSC 101 and printer 102, respectively, in a casewhere communication partner information is registered. Described herewill be an example of display in a case where the DSC 101 registers theprinter 102 as the communication partner. Accordingly, the descriptionthat follows will relate to the examples of the display presented on thedisplay unit 206 of the DSC 101.

FIG. 8A shows an example of a screen displayed in a case where executionof wireless communication via a network has been selected. An item 801is selected in a case where communication is performed upon selecting apreviously registered communication partner; an item 802 is selectedwhen communication partner information is registered; an item 803 isselected in a case where already registered communication partnerinformation is deleted; and an item 804 is selected when wirelesscommunication via the network is cancelled. In order to registercommunication partner information, the user selects item 802 using thecontrol panel 210.

FIG. 8B shows an example of the display unit 206 when item 802 has beenselected. Here an item 805 is selected in a case where DSC informationis registered as the type of communication partner, and an item 806 isselected in a case where printer information is registered as the typeof communication partner. In order for the DSC 101 to register theprinter information as the communication partner, the user selects item806 using the control panel 210.

FIG. 8C shows an example of the display unit 206 when the type ofcommunication partner to be registered has been selected in FIG. 8B(i.e., after item 805 or 806 has been selected). When this screen isbeing displayed, the DSC 101 constructs, between itself and the printer102, a wireless communication network for registration purposes andexecutes processing for registering device information of the kind shownin FIGS. 9A to 9C. The details of this registration processing will bedescribed later.

FIG. 8D shows an example of the display unit 206 after the informationregistration operation between the DSC 101 and printer 102 has beencompleted. Here a button 807 prompts confirmation of processing. If theuser selects button 807 using the control panel 210, the display ofdisplay unit 206 returns to that shown in FIG. 8A.

FIGS. 9A to 9C illustrate examples of some information possessed by eachcommunication apparatus and relating to the apparatus per se. Byexecuting the registration processing described above, eachcommunication apparatus is capable of locally registering communicationpartner information. In FIG. 9A, an SSID 901 is used in a case where thecommunication apparatus establishes an ad-hoc network. Reference numeral902 denotes the type of communication apparatus.

FIG. 9B shows an example of information possessed by the DSC 101, andFIG. 9C shows an example of information possessed by the printer 102.For example, if item 801 is selected, in the DSC 101, from the screendisplay of FIG. 8A after information (FIG. 9C) relating to the printer102 has been registered and the printer 102 is selected from thedisplayed list of communication partners, then the SSID is set to“PrinterNet” and wireless communication with the printer 102 can beperformed.

FIG. 10 is a sequence diagram in a case where the DSC 101 and printer102 execute processing for communication partner registrationrespectively. Here it will be assumed that the method of FIG. 7 is usedas the method of constructing an ad-hoc network for registration of acommunication partner.

When the printer 102 starts executing communication partner registrationprocessing in response to an operation by the user, the applicationprogram issues a request to the driver to construct an ad-hoc networkwhose SSID is “SetNet” (S1001).

Upon receiving the request from the application program, the driverperforms scanning to determine whether an ad-hoc network whose SSID is“SetNet” exists. First, a series of commands for scanning are issuedfrom the driver to the wireless communication controller 304 (S1002).Next, the commands are processed by the wireless communicationcontroller 304 and wireless communication RF unit 305 and a proberequest (search request) is transmitted thereby (S1003). Receipt of aprobe response is awaited for a fixed period of time.

At this point in time the DSC 101 has not yet established an ad-hocnetwork and therefore the response standby time elapses without theprinter 102 receiving a probe response.

Upon confirming that a network does not exist (S1004), the driver of theprinter 102 sends the wireless communication controller 304 a series ofsetting commands for establishing an ad-hoc network whose SSID is“SetNet” (S1005).

The wireless communication controller 304 processes the commandsreceived from the driver and establishes an ad-hoc network having“SetNet” as its SSID. More specifically, the wireless communicationcontroller 304 generates a BSSID from the MAC address of its own printer102 and starts transmitting a beacon.

Here it will be assumed that communication partner registrationprocessing is started on the side of the DSC 101 at the same timing asthat at which the printer 102 starts executing communication partnerregistration processing.

When the DSC 101 starts executing communication partner registrationprocessing in response to an operation by the user, the applicationprogram issues a request to the driver to construct an ad-hoc networkwhose SSID is “SetNet” (S1006).

Upon receiving the request from the application program, the driverperforms scanning to determine whether an ad-hoc network whose SSID is“SetNet” exists. First, a series of commands for scanning are issuedfrom the driver to the wireless communication controller 204 (S1007).

Next, the commands are processed by the wireless communicationcontroller 204 and wireless communication RF unit 205 and a proberequest (search request) is transmitted thereby (S1008). Receipt of aprobe response is awaited for a fixed period of time.

At this point in time the printer 102 has not yet established an ad-hocnetwork and therefore the response standby time elapses without the DSC101 receiving a probe response.

Upon confirming that a network does not exist (S1009), the driver of theDSC 101 sends the wireless communication controller 204 a series ofsetting commands for establishing an ad-hoc network whose SSID is“SetNet” (S1010).

The wireless communication controller 204 processes the commandsreceived from the driver and establishes an ad-hoc network having“SetNet” as its SSID. More specifically, the wireless communicationcontroller 204 generates a BSSID from the MAC address of its own DSC 101and starts transmitting a beacon.

At the moment step S1010 ends, the DSC 101 and printer 102 constructseparate ad-hoc networks having different BSSIDs regardless of the factthat the SSIDs are identical, namely “SetNet”.

After establishing the ad-hoc network (S1005), the printer 102 sets anyvalue T1 in the timer possessed by the system controller 311 (S1011).Similarly, after establishing the ad-hoc network, the DSC 101 sets anyvalue T2 in the timer possessed by the system controller 211 (S1012). InFIG. 12, the time T2 set by the DSC 101 is shorter than the time T1 setby the printer 102 and therefore time T2 in the timer of DSC 101 elapsesfirst.

When time T2 elapses, the DSC 101 performs scanning in order todetermine whether an ad-hoc network having an SSID identical with theSSID “SetNet” of the ad-hoc network established by the DSC 101 itselfexists. First, the driver of the DSC 101 sends the wirelesscommunication controller 204 a series of commands for scanning purposes(S1013). The wireless communication controller 204 and the wirelesscommunication RF unit 205 process the commands and transmit a proberequest (S1014).

Since the printer 102 has specified “SetNet” in the SSID and establishedan ad-hoc network, at this time the printer 102 sends back a proberesponse to the DSC 101 (S1015).

When the DSC 101 receives the probe response, the wireless communicationcontroller 204 delivers to the driver the information obtained from theprobe response (S1016). From the delivered information, the driverdetects the existence of the other ad-hoc network having the same SSIDand a different BSSID from those of the network established by the DSC101.

The DSC 101 compares the BSSID of the network established by the DSC 101itself with the BSSID of the detected network, namely of the networkestablished by the printer 102, and determines thesuperiority/inferiority of the BSSIDs. FIG. 10 shows an example of acase where the BSSID of the network established by the DSC 101 isinferior.

Since the result of the BSSID superiority/inferiority evaluation is thatthe BSSID of the network established by the DSC 101 itself is inferior,the DSC 101 executes processing for participation in the networkestablished by the printer 102.

First, the driver of the DSC 101 sends the wireless communicationcontroller 204 a series of setting commands in order to terminate thenetwork (S1017).

The driver of the DSC 101 then sends the wireless communicationcontroller 204 a series of setting command for participating in thead-hoc network whose SSID is “SetNet” (S1018). The DSC 101 sets theBSSID to a value identical with that of the network established by theprinter 102 and participates in the network.

The DSC 101 performs scanning again in order to determine whetheranother wireless communication apparatus, namely the printer 102, existson the ad-hoc network in which the DSC 101 is participating. The driverof the DSC 101 sends the wireless communication controller 204 a seriesof commands for scanning purposes (S1019). The wireless communicationcontroller 204 and wireless communication RF unit 205 process thecommands and transmit a probe request (S1020).

Since the printer 102 has specified “SetNet” in the SSID and establishedan ad-hoc network, at this time the printer 102 sends back a proberesponse to the DSC 101 (S1021).

When the DSC 101 receives the probe response, the wireless communicationcontroller 204 delivers to the driver the information obtained from theprobe response (S1022). From the delivered information, the driverrecognizes that the BSSID of the network to which the DSC 101 belongsand the BSSID of the detected network are identical. Accordingly, theDSC 101 is capable of confirming that another wireless communicationapparatus, namely the printer 102, exists on the ad-hoc network to whichthe DSC 101 belongs. Here the driver issues the application a signalindicating the completion of the ad-hoc network for the purpose ofcommunication partner registration processing (S1023). Upon being sonotified, the application executes processing for registering theprinter 102 as the communication partner (S1024).

When the time T1 elapses, the printer 102 performs scanning in order todetermine whether an ad-hoc network having an SSID identical with theSSID “SetNet” of the network established by the printer 102 exists. Thedriver of the printer 102 sends the wireless communication controller304 a series of commands for scanning purposes (S1025). The wirelesscommunication controller 304 and the wireless communication RF unit 305process the commands and transmit a probe request (S1026).

Since the DSC 101 is at this time already participating in the ad-hocnetwork established by the printer 102, the DSC 101 sends a proberesponse back to the printer 102 (S1027).

When the printer 102 receives the probe response, the wirelesscommunication controller 304 delivers to the driver the informationobtained from the probe response (S1028). The driver of the printer 102compares the delivered information with the information relating to thenetwork established by the printer 102 and confirms that the DSC 101 isparticipating in the same ad-hoc network as that of the printer 102.

Here the driver of the printer 102 issues the application a signalindicating the completion of the ad-hoc network for the purpose ofcommunication partner registration processing (S1029). Upon being sonotified, the application executes processing for registering theprinter 102 as the communication partner (S1030). That is, at stepS1030, the printer 102 sends back registration information to the DSC101 in response to the registration request from the DSC 101 at stepS1024.

Although the method illustrated in FIG. 7 is used as the method ofconstructing an ad-hoc network for communication partner registration inthis embodiment, the method illustrated in FIG. 5 or 6 may be used.

This embodiment is such that in a case where a temporary ad-hoc networkis constructed in order to execute communication partner registrationprocessing, the processing for registering the communication partner isexecuted after the network is constructed. This makes it possible toexecute registration processing reliably.

Further, although this embodiment has been described taking as anexample a case where communication partner registration processing isexecuted, the processing that follows the construction of the ad-hocnetwork is not limited to communication partner registration processing.For example, the invention is adaptable to a variety of processing, suchas print processing between the DSC and printer, processing fortransferring image files between DSCs, and file transfer processingexecuted upon connecting the DSC and a computer.

Further, in this embodiment, displays of the kind illustrated in FIGS.8A to 8D are presented on the display unit 306 of the printer 102 aswell. However, displays of the kind illustrated in FIGS. 8A to 8D arenot necessarily required. For example, if the printer is one equippedonly with an LED as the display unit 306, a network whose SSID is“PrinterNet” is established when power is introduced from the powersupply. Use may be made of a method of constructing a network (whoseSSID is “SetNet”) for communication partner registration in a case wherea switch (not shown) on the printer control panel 310 is pressed.

(Fourth Embodiment)

In the first and second embodiments, the invention has been describedtaking as an example a case where ad-hoc networks are constructedsubstantially simultaneously by the DSC 101 and printer 102. In the caseof the DSC, the camera is driven by batteries and power consumption is aproblem. Preferably, therefore, a wireless network is constructed onlywhen wireless communication is necessary. In the case of the printer, onthe other hand, often the printer is used upon being connected to an ACpower supply. Consumption of power by wireless communication, therefore,is not much of a problem. Accordingly, a case where a wireless networkis established immediately after power is introduced to the printer isconceivable.

In this case, if the method (see FIGS. 5, 6 and 7) of the foregoingembodiment is used, the printer must perform scanning at fixed timeintervals for a period of time extending from establishment of thenetwork to participation of the other communication apparatus in thenetwork (S506 to S510 in FIG. 5, S606 to S610 in FIG. 6, S706 to S710 inFIG. 7). In this embodiment, therefore, a case will be described inwhich the method of constructing the network is changed depending uponthe functions of each communication apparatus.

FIG. 11 is a flowchart illustrating the flow of operation of the printer102 in this embodiment. If construction of an ad-hoc network isspecified (S1101), the printer 102 performs scanning to determinewhether an ad-hoc network whose SSID is “AdhocNet” exists (S1102,S1103).

If the result of scanning is detection of an ad-hoc network whose SSIDis “AdhocNet” (“YES” at step S1104), the printer 102 executes processingfor participating in the detected ad-hoc network (S1113) and thenterminates processing.

If it is found that ad-hoc network whose SSID is “AdhocNet” does notexist (“NO” at step S1104), then the printer 102 executes processing forestablishing ad-hoc network whose SSID is “AdhocNet” (S1105).

FIG. 12 is a flowchart illustrating the flow of operation of the DSC 101in this embodiment.

If construction of an ad-hoc network with a communication apparatusspecified by the user is instructed (S1201), processing divergesdepending upon whether the type of communication partner specified isequivalent to that of the DSC 101 per se (S1202). If the type ofcommunication partner is equivalent to that of the DSC 101, e.g., if thecommunication partner is a DSC (“YES” at S1202), then processing fromS702 (FIG. 7) onward is executed. It should be noted that the processingfrom S502 (FIG. 5) onward and the processing from S602 (FIG. 6) onwardmay also be executed.

If the type of communication partner is not equivalent to that of theDSC 101 per se, e.g., if it is a printer (“NO” at S1202), then the DSC101 performs network scanning (S1203, S51204) and whether or not anad-hoc network having the same SSID exists is investigated (S1205). Ifan ad-hoc network whose SSID is “AdhocNet” is detected (“YES” at S1205),then the DSC 101 executes processing for participating in this network(S1208).

If an ad-hoc network whose SSID is “AdhocNet” is not detected (“NO” atS1205), the DSC 101 sets any value T in the timer (S1206) and then waitsfor the timer to time out (S1207). If the timer times out (“YES” atS1207), then the DSC 101 performs network scanning again (S1203, S1204).The processing of steps S1203 to S1207 is thus repeated until an ad-hocnetwork whose SSID is “AdhocNet” can be detected. However, in a casewhere the network cannot be detected even though the processing isexecuted a prescribed number of times or for a prescribed period oftime, the processing may be forcibly terminated.

In accordance with this embodiment, it is possible for a communicationapparatus to change the connection method depending upon the type ofcommunication partner when an ad-hoc network is constructed. This makesit possible to construct an ad-hoc network efficiently. The printer needonly stand by until the DSC participates in the network that has beenconstructed by the printer itself, and it is unnecessary to performnetwork scanning. Further, if the communication partner of a DSC is aprinter, the DSC need only wait for the printer to establish thenetwork. This means that the establishment of a network having adifferent BSSID no longer occurs.

It should be noted that although the connection method is changeddepending upon the type of communication partner in the foregoingembodiment, the connection method may be changed depending upon thefunctions, type and attributes, etc., of the communication partner.

Thus, in accordance with each of the embodiments set forth above, evenif a plurality of communication apparatuses that intended to participatein the same network have constructed different networks, one apparatusparticipates in the network established by the other apparatus until thenetwork established by the first-mentioned apparatus is terminated. As aresult, the same network can be constructed reliably. Further, sinceregistration of a communication partner is performed after constructionof a network with a specified communication apparatus has beenconfirmed, a communication apparatus that is incapable of wirelesscommunication will no longer be registered and user convenience can beenhanced. Furthermore, since the method of constructing a network ischanged in dependence upon the type of communication partner, it isunnecessary to execute extra processing and a network can be constructedwith a desired partner in efficient fashion.

In each of the foregoing embodiments, it is described that the BSSID isgenerated arbitrarily based upon the a MAC address, etc. However, theBSSID may be generated by another method. For example, the communicationapparatus may generate random values or the serial number, etc., of thecommunication apparatus may be used as is.

Further, in each of the foregoing embodiments, the invention has beendescribed taking as an example a case where another network is searchedfor (by active scanning) based upon the sending and receiving of a proberequest/probe response. However, network scanning may be performed byanother method. An example is passive scanning, which involvesmonitoring a beacon transmitted by another wireless communicationapparatus. In the case of passive scanning, the received beacon containsthe network information such as the SSID and BSSID.

Further, in the foregoing embodiments, the present invention isdescribed taking as an example a connection between a DSC and a printer.However, the present invention is applicable so long as the apparatus isa communication apparatus having a function that enables theconstruction of an ad-hoc network, such as a connection between DSCs, aconnection between a DSC and a personal computer, and a connectionbetween a printer and a DSC.

Further, the present invention is applicable also to all wirelesscommunication schemes such as a 802.11 wireless LAN, Bluetooth, UWB,wireless USB, wireless 1394 and Wimax. In addition, the presentinvention is applicable not only to wireless communication but also towired communication.

Thus, as described above, even if a plurality of communicationapparatuses that intended to participate in the same network haveconstructed different networks, it is possible for these apparatus toparticipate in the same network. Communication reliability and userconvenience can be enhanced as a result.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all such modifications and equivalent structures andfunctions.

This application claims the benefit of Japanese Patent Application No.2006-040960, filed Feb. 17, 2006, which is hereby incorporated byreference herein in its entirety.

The invention claimed is:
 1. A method of deciding which role of a first role for generating a wireless network and a second role for participating in a generated wireless network, a communication apparatus operates, said method comprising the steps of: generating a wireless network when operating in the first role; participating in a generated wireless network when operating in the second role; comparing first information set in another apparatus with first information set in said communication apparatus; and determining based on second information, in a case where the first information set in said another apparatus is the same as the first information set in said communication apparatus, which of the first role and the second role said communication apparatus operates in, wherein a value of the second information is set randomly in at least one of said communication apparatus and said another apparatus.
 2. The method according to claim 1, wherein the wireless network is a wireless LAN conforming to IEEE802.11 series.
 3. The method according to claim 1, wherein the first information set in said communication apparatus and the first information set in the other apparatus are identification information for identifying a wireless network.
 4. The method according to claim 1 wherein the second information is a BSSID.
 5. The method according to claim 1, further comprising: sending a request; and receiving a response to the request, wherein the first information set in the other apparatus is included in the response.
 6. The method according to claim 5, wherein the request includes the first information set in said communication apparatus.
 7. The method according claim 1 wherein the wireless network is ad-hoc network.
 8. The method according to claim 1 wherein, in the determining step, the role is determined based on a large/small relation of a value represented by the second information randomly set in said communication apparatus and a value represented by the second information randomly set in the another apparatus.
 9. The method according to claim 1, wherein the other apparatus comprises a printer.
 10. The method according to claim 1, wherein the other apparatus comprises a camera.
 11. The method according to claim 1, further comprising displaying a selecting screen for selecting a communication partner with which said communication apparatus communicates in the wireless network.
 12. The method according to claim 1, wherein the second information is randomly set by said communication apparatus and said another apparatus.
 13. The method according to claim 1, wherein the determining step determines that the communication apparatus operates in the first role in a case where a value of the second information set in the communication apparatus is larger than a value of the second information set in said another apparatus, and determines that the communication apparatus operates in the second role in a case where a value of the second information set in the communication apparatus is smaller than a value of the second information set in said another apparatus.
 14. The method according to claim 1, wherein the determination based on the second information is not performed in a case where the first information received by said receiving unit and the first information set in said communication apparatus is not same.
 15. A communication apparatus comprising: a processor; a wireless communication controller; and a memory, wherein the processor, the wireless communication controller, and the memory are operably configured to cause said communication apparatus to: generate a wireless network when operating in a first role; participate in a wireless network when operating in a second role; receive first information set in another apparatus from said another apparatus; determine based on second information, in a case where the received first information and first information set in said communication apparatus are the same as each other, which of the first role and the second role said communication apparatus operates in, wherein the value of the second information is set randomly in at least one of said communication apparatus and said another apparatus; and perform wireless communication with the another apparatus in accordance with the determined role.
 16. The apparatus according to claim 15, wherein the wireless network is a wireless LAN conforming to IEEE802.11 series.
 17. The apparatus according to claim 15, wherein the first information set in said communication apparatus and the first information set in said another apparatus are identification information for identifying a wireless network.
 18. The apparatus according to claim 15, wherein the second information is a BSSID.
 19. The apparatus according to claim 15, wherein the processor, the wireless communication controller, and the memory are operably configured to cause said communication apparatus to: send a request, and wherein the received first information is received in response to the request.
 20. The apparatus according to claim 19, wherein the request includes the first information set in said communication apparatus.
 21. The apparatus according claim 15, wherein the wireless network is ad-hoc network.
 22. The apparatus according to claim 15, wherein the processor, the wireless communication controller, and the memory are operably configured to cause said communication apparatus to determine which of the first role and the second role said communication apparatus operates in based on a large/small relation of a value represented by the second information randomly set in said communication apparatus and a value represented by the second information randomly set in said another apparatus.
 23. The apparatus according to claim 15, wherein at least one of said communication apparatus and said another apparatus comprises a printer.
 24. The apparatus according to claim 15, wherein at least one of said communication apparatus and said another apparatus comprises a camera.
 25. The apparatus according to claim 15, further comprising a display unit configured to display a selecting screen for selecting a communication partner with which said communication apparatus communicates in the wireless network.
 26. The apparatus according to claim 15, wherein the second information is randomly set by said communication apparatus and said another apparatus.
 27. The apparatus according to claim 15, wherein the communication apparatus operates in the first role in a case where a value of the second information set in the communication apparatus is larger than a value of the second information set in said another apparatus, and the communication apparatus operates in the second role in a case where a value of the second information set in the communication apparatus is smaller than a value of the second information set in said another apparatus.
 28. The apparatus according to claim 15, wherein the processor, the wireless communication controller, and the memory are operably configured to cause said communication apparatus to not determine which of the first role and the second role said communication apparatus operates in in a case where the received first information and the first information set in said communication apparatus are not same.
 29. A non-transitory computer readable medium storing a program causing a computer to execute the steps of: generating a wireless network when operating in the first role; participating in a generated wireless network when operating in the second role; comparing first information set in another apparatus with first information set in said communication apparatus; and determining based on second information, in a case where the first information set in said another apparatus is the same as the first information set in said communication apparatus, which of the first role or the second role said communication apparatus operates in, wherein a value of the second information is set randomly in at least one of said communication apparatus and said another apparatus. 